Skip to content

Use instrument-generic futures routes in Python 1.12.6 - #90

Merged
karlwaldman merged 2 commits into
mainfrom
codex/futures-canonical-routes-1-12-6
Aug 11, 2026
Merged

Use instrument-generic futures routes in Python 1.12.6#90
karlwaldman merged 2 commits into
mainfrom
codex/futures-canonical-routes-1-12-6

Conversation

@karlwaldman

@karlwaldman karlwaldman commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

  • route canonical, code, and legacy futures inputs through instrument-generic API paths in sync and async clients
  • retain venue-slug compatibility while preferring brent, wti, gasoil, and eu-carbon in public examples
  • bump the package to 1.12.6 and bind the packaged example guard

Red-green proof

  • red: the old implementation produced 134 route-matrix failures; added underscore alias cases separately failed for EU_CARBON and UK_CARBON
  • green: 619 passed, 13 skipped; 63.58% coverage
  • ruff green; mypy green with the repository-required --ignore-missing-imports; pip-audit found no vulnerabilities
  • storefront guard validated 63 public surfaces
  • exact local wheel at 521fbaed19e5d715c2369b55ac277509ef084e59: 53 files, recursive installed-artifact claim scan green, clean import/route-map smoke green
  • authenticated production smoke green for canonical slug, contract code, legacy input, and curve

Refs OilpriceAPI/oilpriceapi-api#4175

Summary by CodeRabbit

  • New Features

    • Futures requests now support instrument-based routes for Brent, WTI, gasoil, and EU carbon.
    • Contract codes and legacy venue-based slugs remain supported for compatibility.
    • Generic slugs are now used consistently across synchronous and asynchronous futures operations.
  • Documentation

    • Updated futures examples and guidance to recommend instrument-based slugs.
  • Release

    • Updated the package to version 1.12.6.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@karlwaldman, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cd326979-a278-4fb4-b5fc-59f1d35c198f

📥 Commits

Reviewing files that changed from the base of the PR and between 521fbae and 3ffed9b.

📒 Files selected for processing (3)
  • oilpriceapi/async_resources.py
  • oilpriceapi/resources/futures.py
  • tests/test_release_readiness.py
📝 Walkthrough

Walkthrough

The SDK now routes Brent, WTI, gasoil, and EU carbon futures through instrument-generic API slugs. Legacy venue slugs and contract codes remain accepted. Synchronous and asynchronous resources, tests, documentation, and release metadata now reflect version 1.12.6.

Changes

Futures Routing

Layer / File(s) Summary
Canonical slug normalization
oilpriceapi/resources/_futures_slug.py, tests/unit/test_futures_slug.py
Normalization returns generic slugs such as brent, wti, gasoil, and eu-carbon. Legacy slugs and contract codes map to these values.
Resource route generation
oilpriceapi/resources/futures.py, oilpriceapi/async_resources.py, tests/unit/test_futures_resource.py, tests/unit/test_async_futures_resource.py
Synchronous and asynchronous futures methods generate canonical generic routes, including continuous futures routes. Examples use generic slugs.
Release metadata and validation
CHANGELOG.md, oilpriceapi/version.py, pyproject.toml, tests/integration/test_live_futures.py, tests/test_release_readiness.py
Version 1.12.6 and its changelog entry are recorded. Integration and release-readiness tests validate generic routes, legacy compatibility, and packaged examples.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant normalize_futures_slug
  participant FuturesResource
  participant FuturesAPI
  Client->>normalize_futures_slug: Send generic slug, legacy slug, or contract code
  normalize_futures_slug->>FuturesResource: Resolve canonical instrument slug
  FuturesResource->>FuturesAPI: Request generic futures endpoint
  FuturesAPI-->>Client: Return futures data
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: routing futures through instrument-generic paths in the Python SDK.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/futures-canonical-routes-1-12-6

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_release_readiness.py`:
- Around line 90-102: Update
test_packaged_futures_examples_prefer_instrument_generic_slugs to validate
oilpriceapi/resources/futures.py and oilpriceapi/async_resources.py separately,
preventing one module from satisfying another’s requirements. Require the
generic examples for brent, wti, gasoil, and eu-carbon in both synchronous and
asynchronous forms, while preserving the existing prohibition on ice- and
eua-prefixed slugs.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a810599f-8f0d-4bdb-87a2-ac66ba85533c

📥 Commits

Reviewing files that changed from the base of the PR and between c4e222e and 521fbae.

📒 Files selected for processing (11)
  • CHANGELOG.md
  • oilpriceapi/async_resources.py
  • oilpriceapi/resources/_futures_slug.py
  • oilpriceapi/resources/futures.py
  • oilpriceapi/version.py
  • pyproject.toml
  • tests/integration/test_live_futures.py
  • tests/test_release_readiness.py
  • tests/unit/test_async_futures_resource.py
  • tests/unit/test_futures_resource.py
  • tests/unit/test_futures_slug.py

Comment thread tests/test_release_readiness.py Outdated
@karlwaldman
karlwaldman merged commit f17936a into main Aug 11, 2026
7 checks passed
@karlwaldman
karlwaldman deleted the codex/futures-canonical-routes-1-12-6 branch August 11, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant